package top.txl.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.txl.entity.R;
import top.txl.entity.RouterInfos;
import top.txl.service.RouterInfosService;

import java.util.List;

@CrossOrigin
@Slf4j
@RestController
@RequestMapping("/router")
public class RouterInfosController {

    @Autowired
    private RouterInfosService routerInfosService;

    @GetMapping("/lists")
    public R <List <RouterInfos>> lists() {
        log.info("查询routes");
        List<RouterInfos> routes = routerInfosService.lists();
        return R.success(routes);
    }
}
